package com.tandashi.springbootstudy01.study.enums;

public enum Size {

    SMALL("S"),
    MEDIUM("M"),
    LARGE("L"),
    EXTRA_LARGE("XL");
    private String abbr;

    Size(String abbr) {
        this.abbr = abbr;
    }

    public String getAbbr() {
        return abbr;
    }

    public static void main(String[] args) {
        Size s = Enum.valueOf(Size.class, "SMALL");
        String s1 = Size.SMALL.toString();
        System.out.println("s="+s+",s1="+s1);
        Size[] values = Size.values();
        for (Size size: values) {
            System.out.println("size="+size+",ordinal="+size.ordinal()+",name="+size.name());
        }

    }
}
